import hzcRequest from "../../../utils/https";

// 预付订单savePreOrder
const savePreOrder=(data)=>{
    return hzcRequest.post(`/api/ln/savePreOrder`,data)
}
// 付款方式
const getPayList=(data)=>{
    return hzcRequest.post(`/api/ln/getPayList`,data)
}

//付款
const payOrderCallbackTest=(data)=>{
    return hzcRequest.post(`/api/ln/payOrderCallbackTest`,data)
}


// getGoodsOrderPage
//订单列表
const getGoodsOrderPage=(data)=>{
    return hzcRequest.post(`/api/ln/getGoodsOrderPage`,data)
}

// 取消订单
const cancelGoodsOrder=(data)=>{
    return hzcRequest.post(`/api/ln/cancelGoodsOrder`,data)
}
//删除订单

const delGoodsOrder=(data)=>{
    return hzcRequest.post(`/api/ln/delGoodsOrder`,data)
}


//确认收货confirmGoodsOrderArrival
const confirmGoodsOrderArrival=(data)=>{
    return hzcRequest.post(`/api/ln/confirmGoodsOrderArrival`,data)
}

//订单详情confirmGoodsOrderArrival
const getGoodsOrderDetails=(data)=>{
    return hzcRequest.post(`/api/ln/getGoodsOrderDetails`,data)
}






// 微信小程序下单
const placeOrder = (data) => {
  return hzcRequest.post(`/api/order/placeOrder`, data);
};

// 微信支付接口
const weixinPay = (data) => {
  return hzcRequest.post(`/api/pay/wxPay`, data);
};



// 我的订单
const orderInfoByTypeAndStatus = (data) => {
  return hzcRequest.post(
    `/api/order/orderInfoByTypeAndStatus?orderType=${data.orderType}&status=${data.status}&current=${data.current}&size=${data.size}`
  );
};

//订单更新状态
const updateOrderStatusByOrderSn = (data) => {
  return hzcRequest.post(`/api/order/updateOrderStatusByOrderSn`, data);
};

//根据订单编号获取订单token
const getOrderTokenByOrderSn = (params) => {
  return hzcRequest.post(
    `/api/orderToken/getOrderTokenByOrderSn?orderSn=${params}`
  );
};

//删除订单
const cancelDelete = (params) => {
  return hzcRequest.post(`/api/order/delOrder?orderSn=${params}`);
};

// 按订单编号查询订单
const getOrderInfoByOrderSnApi = (params) => {
  return hzcRequest.post(`/api/order/getOrderInfoByOrderSn?orderSn=${params}`);
};

// 取消退款
const cancelApi = (data) => {
  return hzcRequest.post(`/api/order/cancel`, data);
};

// 申请退款
const refundOrder = (data) => {
  return hzcRequest.put(`/api/refundOrder/refundOrder`, data);
};

export {
	savePreOrder,
	payOrderCallbackTest,
	getGoodsOrderPage,
	cancelGoodsOrder,
	delGoodsOrder,
	confirmGoodsOrderArrival,
	getGoodsOrderDetails,
	getPayList,
	
	
	
  refundOrder,
  cancelApi,
  getOrderInfoByOrderSnApi,
  placeOrder,
  weixinPay,
  orderInfoByTypeAndStatus,
  updateOrderStatusByOrderSn,
  getOrderTokenByOrderSn,
  cancelDelete,
};
